<template>
    <div>
        <el-form :inline="false" :model="formInline" class="demo-form-inline">
            <el-form-item label="测试1">
                <el-input v-model="formInline.date" placeholder="请输入测试内容" clearable />
            </el-form-item>
        </el-form>
        <!-- start -->
        <!-- end -->
        <div class="float-right">
            <el-button type="primary" @click="handelOk">确 定</el-button>
            <el-button @click="emit('close')">取 消</el-button>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
const formInline = ref({
    date: ""
})

const emit = defineEmits(['success', 'close'])
const props = defineProps({
    data: Number
})

// 点击handelok事件，将数据传递给父组件
function handelOk() {
    emit('success', formInline.value)
    emit('close')
}


const childMehtod = () => {
    console.log("父组件通过ref来调用子组件的方法,并打印了数据", props.data)
    formInline.value.date = props.data
}
// 将 query 方法暴露给父组件
defineExpose({ childMehtod })
</script>